<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>课堂文件分享</title>
    <style>
        body {
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
            margin: 0;
            background-color: #f8f9fa;
        }

        .container {
            max-width: 900px;
            margin: 20px auto;
            padding: 20px;
            background-color: #fff;
            border-radius: 8px;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
        }

        h1 {
            color: #333;
            text-align: center;
            border-bottom: 2px solid #eee;
            padding-bottom: 10px;
        }

        h1 small {
            font-size: 0.5em;
            color: #888;
            display: block;
            margin-top: 5px;
        }

        table {
            width: 100%;
            border-collapse: collapse;
            margin-top: 20px;
        }

        th, td {
            padding: 12px 15px;
            text-align: left;
            border-bottom: 1px solid #ddd;
        }

        th {
            background-color: #f2f2f2;
            font-weight: 600;
        }

        tr:hover {
            background-color: #f1f1f1;
        }

        a {
            color: #007bff;
            text-decoration: none;
            font-weight: 500;
        }

        a:hover {
            text-decoration: underline;
        }

        .footer {
            text-align: center;
            margin-top: 20px;
            color: #aaa;
            font-size: 0.9em;
        }
    </style>
</head>
<body>
<div class="container">
    <h1>课堂文件分享 <small>由教师电脑 ({{ server_address }}) 提供</small></h1>
    <table>
        <thead>
        <tr>
            <th>文件名</th>
            <th>大小</th>
            <th>最后修改时间</th>
        </tr>
        </thead>
        <tbody>
        {% if files %}
        {% for file in files %}
        <tr>
            <td><a href="/download/{{ file.name }}" target="_blank">{{ file.name }}</a></td>
            <td>{{ file.size }}</td>
            <td>{{ file.modified_time }}</td>
        </tr>
        {% endfor %}
        {% else %}
        <tr>
            <td colspan="3" style="text-align: center; color: #888;">"shared_files" 文件夹中暂无文件</td>
        </tr>
        {% endif %}
        </tbody>
    </table>
</div>
<div class="footer">
    <p>LAN File Sharer by Gemini</p>
</div>
</body>
</html>